class CreateSaleOrderHxes < ActiveRecord::Migration
  def self.up
    create_table :sale_order_hxes do |t|
      t.integer :company_id       ,:null => false              #所属公司的ID
      t.integer :department_id    ,:null => false              #员工所在的部门ID
      t.integer :employee_id      ,:null => false              #员工ID
      t.integer :sale_order_id    ,:null => false              #销售订单ID
      t.decimal :amount  , :precision => 10, :scale => 2  ,:default => 0       #订单总价
      t.string :description                     #备注或一些更详细信息可以在这儿填写
      t.integer :is_locked     , :limit => 1    , :default => 0 #锁定 1为True 0为False
      t.integer :lock_version  , :default => 0  #乐观锁
      t.timestamps
    end
  end

  def self.down
    drop_table :sale_order_hxes
  end
end
